package org.hackystat.app.projectstatus.view;

import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import javax.servlet.http.HttpServletRequest;

import org.hackystat.core.common.project.ProjectManager;
import org.hackystat.core.kernel.mvc.CommandRequest;
import org.hackystat.core.kernel.mvc.Page;
import org.hackystat.core.kernel.user.User;

/**
 * Implements the entry to the Alert Management page from the 
 * exterior Hackystat Preferences page.
 * 
 * @author Josh Stupplebeen
 *
 */
public class AlertManager implements CommandRequest {
  
  /** Map of a project name to its enabled status. ie. "ProjectName" -> "enabled".*/
  private Map<String, String> alertEnabled = new HashMap<String, String>();
  
  /** List of emails entered by a project owner of who will be recieving emails. */
  private static List<String> alertEmails = new ArrayList<String>();
  
  /** Map of a project name to the list of emails which will be recieving emails. */
  private Map<String, List<String>> projectEmails = new HashMap<String, List<String>>();

  /** User key which may be used to store the user with this alert enabled. */
  public static final String PROJSTATUSALERTENABLED_KEY = "alert.AlertManager";
  

  /**
   * The process method.
   * @param request the page request.
   * @param user The user logged in.
   * @return The Preferences page or Error page.
   */
  public Page process(HttpServletRequest request, User user) {
    ProjectManager manager = ProjectManager.getInstance();
    request.setAttribute("ProjectsOwned", manager.getProjectsWithOwner(user));
    request.setAttribute("member", user.getUserEmail());
    return new Page("/AlertManager.jsp", "Alert<br>Management");
  }
  

}
